<template>
  <a-card :bordered="false">
      <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->

    <!-- 操作按钮区域 -->
    <div class="table-operator">
      <a-button @click="handleAdd" type="primary" icon="plus" :disabled="isDisabledAuth('erpFinancePaymentSlipFeeDetail:add')">新增</a-button>
      <a-button type="primary" icon="download" @click="handleExportXls('erp_finance_payment_slip_fee_detail')" :disabled="isDisabledAuth('erpFinancePaymentSlipFeeDetail:export')">导出</a-button>
      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
        <a-button type="primary" icon="import" :disabled="isDisabledAuth('erpFinancePaymentSlipFeeDetail:import')">导入</a-button>
      </a-upload>
      <!-- 高级查询区域 -->
      <!--<j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>-->
      <a-dropdown v-if="selectedRowKeys.length > 0">
        <a-menu slot="overlay">
          <a-menu-item key="1" @click="batchDel" :disabled="isDisabledAuth('erpFinancePaymentSlipFeeDetail:delete')"><a-icon type="delete"/>删除</a-menu-item>
        </a-menu>
        <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
      </a-dropdown>
      <a-popover title="自定义列" trigger="click" placement="leftBottom">
        <template slot="content">
          <a-checkbox-group @change="onColSettingsChange" v-model="settingColumns" :defaultValue="settingColumns">
            <a-row>
              <template v-for="(item,index) in defColumns">
                <template v-if="item.key!='rowIndex'&& item.dataIndex!='action'">
                  <a-col :span="12"><a-checkbox :value="item.dataIndex">{{ item.title }}</a-checkbox></a-col>
                </template>
              </template>
            </a-row>
          </a-checkbox-group>
        </template>
        <a style="float: right;"><a-icon type="setting" :style='iconStyle'/></a>
      </a-popover>
    </div>

    <!-- table区域-begin -->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div>

      <a-table
        ref="table"
        size="middle"
        :scroll="{x:true}"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        class="j-table-force-nowrap"
        :customRow="customRow"
        @change="handleTableChange">
        <template slot="status" slot-scope="status">
           <a-badge :status="status | statusTypeFilter" :text="status | statusFilter"/>
        </template>
        <template slot="htmlSlot" slot-scope="text">
          <div v-html="text"></div>
        </template>
        <template slot="imgSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
          <img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
        </template>
        <template slot="fileSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
          <a-button
            v-else
            :ghost="true"
            type="primary"
            icon="download"
            size="small"
            @click="downloadFile(text)">
            下载
          </a-button>
        </template>

        <span slot="action" slot-scope="text, record">
            <a-button
                class="ruleButton"
                :ghost="true"
                type="primary"
                icon="edit"
                @click="handleEdit(record)"
                :disabled="isDisabledAuth('erpFinancePaymentSlipFeeDetail:edit')"
        />
        <a-divider type="vertical"/>
        <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
            <a-button
                    class="ruleButton"
                    :ghost="true"
                    type="primary"
                    icon="delete"
                    :disabled="isDisabledAuth('erpFinancePaymentSlipFeeDetail:delete')"/>
        </a-popconfirm>
        </span>

      </a-table>
    </div>

    <erp-finance-payment-slip-fee-detail-modal ref="modalForm" @ok="modalFormOk"></erp-finance-payment-slip-fee-detail-modal>
  </a-card>
</template>

<script>

  import '@/assets/less/TableExpand.less'
  import { mixinDevice } from '@/utils/mixin'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import ErpFinancePaymentSlipFeeDetailModal from './modules/ErpFinancePaymentSlipFeeDetailModal'
  import {DisabledAuthFilterMixin} from '@/mixins/DisabledAuthFilterMixin'

  export default {
    name: 'ErpFinancePaymentSlipFeeDetailList',
    mixins:[JeecgListMixin, mixinDevice, DisabledAuthFilterMixin],
    components: {
      ErpFinancePaymentSlipFeeDetailModal,
    },
    data () {
      return {
        description: 'erp_finance_payment_slip_fee_detail管理页面',
        //表头
        columns:[],
        //列设置
        settingColumns:[],
        // 列定义
        defColumns: [
          {
            title: '序号',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
          },
          {
            title:'项目编号',
            align:"center",
            dataIndex: 'projectId',
          },
          {
            title:'合同编号',
            align:"center",
            dataIndex: 'contractId',
          },
          {
            title:'项目费用类别（字典）',
            align:"center",
            dataIndex: 'projectFeeType',
          },
          {
            title:'团队年度',
            align:"center",
            dataIndex: 'teamYear_dictText',
          },
          {
            title:'团队编号',
            align:"center",
            dataIndex: 'teamId',
          },
          {
            title:'团队领导',
            align:"center",
            dataIndex: 'teamLeader',
          },
          {
            title:'应付（元）',
            align:"center",
            dataIndex: 'payableAmount',
          },
          {
            title:'已付（元）',
            align:"center",
            dataIndex: 'paidAmount',
          },
          {
            title:'扣款（元）',
            align:"center",
            dataIndex: 'deductionAmount',
          },
          {
            title:'本次扣款（元）',
            align:"center",
            dataIndex: 'currentDeductionAmount',
          },
          {
            title:'未付款（元）',
            align:"center",
            dataIndex: 'unpaidAmount',
          },
          {
            title:'关联费用报销单',
            align:"center",
            dataIndex: 'relReimbursementBillId',
          },
          {
            title:'费用报销类别（字典）',
            align:"center",
            dataIndex: 'reimbursementFeeType',
          },
          {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            fixed:"right",
            width:147,
            scopedSlots: {
            filterDropdown: 'filterDropdown',
            filterIcon: 'filterIcon',
            customRender: 'action' }
          }
        ],
        url: {
          list: "/api/erp/finance/payment/erpFinancePaymentSlipFeeDetail/list",
          delete: "/api/erp/finance/payment/erpFinancePaymentSlipFeeDetail/delete",
          deleteBatch: "/api/erp/finance/payment/erpFinancePaymentSlipFeeDetail/deleteBatch",
          exportXlsUrl: "/api/erp/finance/payment/erpFinancePaymentSlipFeeDetail/exportXls",
          importExcelUrl: "finance/payment/erpFinancePaymentSlipFeeDetail/importExcel",
        },
        dictOptions:{},
        superFieldList:[],
      }
    },
    created() {
      this.getSuperFieldList();
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      },
    },
    methods: {
      initDictConfig(){
      },
      getSuperFieldList(){
        let fieldList=[];
        fieldList.push({type:'string',value:'remark',text:'备注',dictCode:''})
        fieldList.push({type:'string',value:'projectId',text:'项目编号',dictCode:''})
        fieldList.push({type:'string',value:'contractId',text:'合同编号',dictCode:''})
        fieldList.push({type:'string',value:'projectFeeType',text:'项目费用类别（字典）',dictCode:''})
        fieldList.push({type:'string',value:'teamYear',text:'团队年度',dictCode:''})
        fieldList.push({type:'string',value:'teamId',text:'团队编号',dictCode:''})
        fieldList.push({type:'string',value:'teamLeader',text:'团队领导',dictCode:''})
        fieldList.push({type:'BigDecimal',value:'payableAmount',text:'应付',dictCode:''})
        fieldList.push({type:'BigDecimal',value:'paidAmount',text:'已付',dictCode:''})
        fieldList.push({type:'BigDecimal',value:'deductionAmount',text:'扣款',dictCode:''})
        fieldList.push({type:'BigDecimal',value:'currentDeductionAmount',text:'本次扣款',dictCode:''})
        fieldList.push({type:'BigDecimal',value:'unpaidAmount',text:'未付款',dictCode:''})
        fieldList.push({type:'string',value:'relReimbursementBillId',text:'关联费用报销单',dictCode:''})
        fieldList.push({type:'string',value:'reimbursementFeeType',text:'费用报销类别（字典）',dictCode:''})
        this.superFieldList = fieldList
      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>
